// JavaScript Document
function changeDays(sAnio,sMes){
	var iNumDaysByMes = 0;
	var oSelectLoadDays = document.getElementById('dias');
	var sSelectToLoad = ""; 
	
	if(sMes == 1 || sMes == 3 || sMes == 5 || sMes == 7 || sMes == 8 || sMes == 10 || sMes == 12)
		iNumDaysByMes = 32;
	else if (sMes == 4 || sMes ==6 || sMes == 9 || sMes == 11 )
		iNumDaysByMes = 31;
	else
		if ((sAnio % 4 == 0) && ((sAnio % 100 != 0) || (sAnio % 400 == 0)))
			iNumDaysByMes = 30;
		else
			iNumDaysByMes = 29;
	
	sSelectToLoad = '<select name="diaFin">';
	for(var iNumDays=1;iNumDays<iNumDaysByMes;iNumDays++)
		if(iNumDays<10)
			sSelectToLoad += '<option value="0'+iNumDays+'"> 0'+iNumDays+' </option>';
		else
			sSelectToLoad +='<option value="'+iNumDays+'"> '+iNumDays+' </option>';
	
	sSelectToLoad += '</select>';
	
	oSelectLoadDays.innerHTML = sSelectToLoad; 
}

function showNewEvent(sEvent){
	window.opener.addEvent(sEvent); 
	window.close();
}

function updateEvent(sEvent){
	window.opener.updateEvent(sEvent); 
	window.close();
}

function deleteEvent(sEvent){
	window.opener.deleteEvent(sEvent); 
	window.close();
}